package edu.zut.cs.javaee.manager.department.domain;


import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import edu.zut.cs.javaee.manager.base.domain.BaseEntity;
import edu.zut.cs.javaee.manager.base.domain.BaseTreeEntity;

/**
* @author 57281
* department->leadership
* 1->n
*
*/
@Entity
@Table(name = "T_DEPARTMENT")
/**
 * entity for department
 * @author 57281
 *
 */
//confused
//@NamedQueries({ @NamedQuery(name = "Department.getRoot", query = "select s from Department s where m.parent is null ") })
@NamedQueries({ @NamedQuery(name = "Department.getRoot", query = "select s from Department s ") })


public class Department extends BaseTreeEntity<Department,Long>{


	/**
	 * 
	 */
	private static final long serialVersionUID = 4505556519590783755L;
	@Column
	String Sname;
	@Column
	String Sno;
	@Column
	int amount;
	
	/**
	 * 1->n contact
	 */
	@OneToMany(mappedBy = "department", cascade = CascadeType.REMOVE, fetch = FetchType.EAGER)
	List<Leadership> leaderships;	
	
	
	public String getSname() {
		return Sname;
	}
	public void setSname(String sname) {
		Sname = sname;
	}
	public String getSno() {
		return Sno;
	}
	public void setSno(String sno) {
		Sno = sno;
	}
	public int getAmount() {
		return amount;
	}
	public void setAmount(int amount) {
		this.amount = amount;
	
	
	}

}
